package com.boot.learning;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.data.redis.connection.RedisConnectionFactory;

import com.boot.learning.captcha.CaptchaService;
import com.boot.learning.captcha.RedisCaptchaService;

@SpringBootApplication
public class Application {

	public static void main(String[] args) throws Exception {
		SpringApplication.run(Application.class, args);
	}
	
	@Autowired
	private RedisConnectionFactory connectionFactory;

	@Bean
	public CaptchaService captchaService(){
		return new RedisCaptchaService( connectionFactory );
	}
	
	@Autowired
	private CaptchaService captchaService;
}
